﻿
namespace NetROS.Tiers.Windows.Forms
{
	/// <summary>
	/// abstract BlagajnaStavka typed datagridview
	/// </summary>
	[System.ComponentModel.DesignerCategoryAttribute("code")]
	public abstract class BlagajnaStavkaDataGridViewBase : System.Windows.Forms.UserControl
	{	
		/// <summary> 
		/// Thrown when the current Entity changed.
		/// </summary>
		public event System.EventHandler<BlagajnaStavkaDataGridViewEventArgs> CurrentEntityChanged;
		
		#region Fields
				
		/// <summary> 
		/// the current entity.
		/// </summary>
		private Entities.BlagajnaStavka _currentBlagajnaStavka = null;
		//private Dictionary<string, string> _columnsHeaders = new Dictionary<string, string>();
		
		/// <summary> 
		/// the datagridview instance
		/// </summary>
		protected System.Windows.Forms.DataGridView uxBlagajnaStavkaDataGridView;
		
		/// <summary> 
		/// the errorprovider
		/// </summary>
		protected System.Windows.Forms.ErrorProvider uxBlagajnaStavkaErrorProvider;
		
		/// <summary> 
		/// the bindingsource
		/// </summary>
		protected System.Windows.Forms.BindingSource uxBlagajnaStavkaBindingSource;
		
		
		/// <summary> 
		/// the DGV column associated with the ID property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxIDDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDBlagajnaIzvjestaj property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDBlagajnaIzvjestajDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the DatumDokumenta property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxDatumDokumentaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Ulaz property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxUlazDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Izlaz property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxIzlazDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the DateUICreated property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxDateUICreatedDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Opis property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxOpisDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDKonto property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDKontoDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the Primatelj property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxPrimateljDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the IDOrganizacija property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxIDOrganizacijaDataGridViewColumn;
		
		/// <summary> 
		/// the DGV column associated with the TipStavke property
		/// </summary>
		protected System.Windows.Forms.DataGridViewTextBoxColumn uxTipStavkeDataGridViewColumn;
		/// <summary> 
		/// the DGV column associated with the IDKlijent property
		/// </summary>
		protected System.Windows.Forms.DataGridViewComboBoxColumn uxIDKlijentDataGridViewColumn;
		
		#endregion
					
		#region Combo list
		
				
		private Entities.TList<Entities.BlagajnaIzvjestaj> _IDBlagajnaIzvjestajList;
		
		/// <summary> 
		/// The list of selectable BlagajnaIzvjestaj
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.BlagajnaIzvjestaj> IDBlagajnaIzvjestajList
		{
			get {return this._IDBlagajnaIzvjestajList;}
			set 
			{
				this._IDBlagajnaIzvjestajList = value;
				this.uxIDBlagajnaIzvjestajDataGridViewColumn.DataSource = null;
				this.uxIDBlagajnaIzvjestajDataGridViewColumn.DataSource = this._IDBlagajnaIzvjestajList;
			}
		}
		
		private bool _allowNewItemInIDBlagajnaIzvjestajList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of BlagajnaIzvjestaj
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDBlagajnaIzvjestajList
		{
			get { return _allowNewItemInIDBlagajnaIzvjestajList;}
			set
			{
				this._allowNewItemInIDBlagajnaIzvjestajList = value;
				this.uxIDBlagajnaIzvjestajDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.Klijent> _IDKlijentList;
		
		/// <summary> 
		/// The list of selectable Klijent
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Klijent> IDKlijentList
		{
			get {return this._IDKlijentList;}
			set 
			{
				this._IDKlijentList = value;
				this.uxIDKlijentDataGridViewColumn.DataSource = null;
				this.uxIDKlijentDataGridViewColumn.DataSource = this._IDKlijentList;
			}
		}
		
		private bool _allowNewItemInIDKlijentList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Klijent
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDKlijentList
		{
			get { return _allowNewItemInIDKlijentList;}
			set
			{
				this._allowNewItemInIDKlijentList = value;
				this.uxIDKlijentDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
				
		private Entities.TList<Entities.Konto> _IDKontoList;
		
		/// <summary> 
		/// The list of selectable Konto
		/// </summary>
		[System.ComponentModel.Category("DropDownList BindingSources")]
		public Entities.TList<Entities.Konto> IDKontoList
		{
			get {return this._IDKontoList;}
			set 
			{
				this._IDKontoList = value;
				this.uxIDKontoDataGridViewColumn.DataSource = null;
				this.uxIDKontoDataGridViewColumn.DataSource = this._IDKontoList;
			}
		}
		
		private bool _allowNewItemInIDKontoList;
		
		/// <summary> 
		/// Indicates if user can add an item in the list of Konto
		/// </summary>
		[System.ComponentModel.Category(".netTiers"), System.ComponentModel.Description("Indicates if end user can add a new item in the combobox. an event will be thrown then.")]
		public bool AllowNewItemInIDKontoList
		{
			get { return _allowNewItemInIDKontoList;}
			set
			{
				this._allowNewItemInIDKontoList = value;
				this.uxIDKontoDataGridViewColumn.DisplayStyle = value ? System.Windows.Forms.DataGridViewComboBoxDisplayStyle.ComboBox : System.Windows.Forms.DataGridViewComboBoxDisplayStyle.DropDownButton;
			}
		}
		
		#endregion
		
		#region Main Datasource
		
		private Entities.TList<Entities.BlagajnaStavka> _BlagajnaStavkaList;
				
		/// <summary> 
		/// The list of BlagajnaStavka to be displayed in the DGV.
		/// </summary>
		[System.ComponentModel.Category("Data")]
		public Entities.TList<Entities.BlagajnaStavka> BlagajnaStavkaList
		{
			get {return this._BlagajnaStavkaList;}
			set
			{
				this._BlagajnaStavkaList = value;
				this.uxBlagajnaStavkaBindingSource.DataSource = null;
				this.uxBlagajnaStavkaBindingSource.DataSource = value;
				this.uxBlagajnaStavkaDataGridView.DataSource = null;
				this.uxBlagajnaStavkaDataGridView.DataSource = this.uxBlagajnaStavkaBindingSource;				
				//this.uxBlagajnaStavkaBindingSource.ListChanged += new System.ComponentModel.ListChangedEventHandler(uxBlagajnaStavkaBindingSource_ListChanged);
				this.uxBlagajnaStavkaBindingSource.CurrentItemChanged += new System.EventHandler(OnBlagajnaStavkaBindingSourceCurrentItemChanged);
			}
		}
		
		private void OnBlagajnaStavkaBindingSourceCurrentItemChanged(object sender, System.EventArgs e)
		{
			_currentBlagajnaStavka = uxBlagajnaStavkaBindingSource.Current as Entities.BlagajnaStavka;
			
			if (_currentBlagajnaStavka != null)
			{
				_currentBlagajnaStavka.Validate();
			}
			//_BlagajnaStavka.Validate();
			OnCurrentEntityChanged();
		}

		//void uxBlagajnaStavkaBindingSource_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
		//{
			//throw new Exception("The method or operation is not implemented.");
		//}		
		
		#endregion
		
		/// <summary>
		/// Gets the currently selected <c cref="Entities.BlagajnaStavka"/> instance.
		/// </summary>
		public Entities.BlagajnaStavka SelectedBlagajnaStavka
		{
			get {return this._currentBlagajnaStavka;}
		}
		
		#region other properties
		
		/// <summary>
		/// Gets or sets a value indicating whether you have provided your own data-management operations for the DataGridView control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool VirtualMode
		{
			get {return this.uxBlagajnaStavkaDataGridView.VirtualMode;}
			set
			{
				this.uxBlagajnaStavkaDataGridView.VirtualMode = value;
			}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the option to add rows is displayed to the user.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToAddRows
		{
			get {return this.uxBlagajnaStavkaDataGridView.AllowUserToAddRows;}
			set {this.uxBlagajnaStavkaDataGridView.AllowUserToAddRows = value;}
		}
		
		/// <summary>
		/// Gets or sets a value indicating whether the user is allowed to delete rows from the DataGridView.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public bool AllowUserToDeleteRows
		{
			get {return this.uxBlagajnaStavkaDataGridView.AllowUserToDeleteRows;}
			set {this.uxBlagajnaStavkaDataGridView.AllowUserToDeleteRows = value;}
		}
		
		/// <summary>
		/// Gets the <c cref="DataGridView"/> instance.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]
		public System.Windows.Forms.DataGridView DataGridView
		{
			get {return this.uxBlagajnaStavkaDataGridView;}
		}
		
		/// <summary>
		/// Gets a collection that contains all the columns in the control.
		/// </summary>
		[System.ComponentModel.Category(".netTiers")]		
		[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Visible)]
		//[System.ComponentModel.EditorAttribute("System.Windows.Forms.Design.DataGridViewColumnCollectionEditor, System.Design", typeof(System.Drawing.Design.UITypeEditor))] 
		public System.Windows.Forms.DataGridViewColumnCollection Columns
		{
			get { return this.uxBlagajnaStavkaDataGridView.Columns; }
		}
		
		#endregion
		
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;
	
		/// <summary> 
		/// Clean up any resources being used.
		/// </summary>
		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing && (components != null))
			{
				components.Dispose();
			}
			base.Dispose(disposing);
		}
	
		#region Constructor
	
		/// <summary>
		/// Initializes a new instance of the <see cref="BlagajnaStavkaDataGridViewBase"/> class.
		/// </summary>
		public BlagajnaStavkaDataGridViewBase()
		{			
			this.components = new System.ComponentModel.Container();			
			
			this.uxBlagajnaStavkaDataGridView = new System.Windows.Forms.DataGridView();
			this.uxBlagajnaStavkaBindingSource = new System.Windows.Forms.BindingSource(this.components);
			this.uxBlagajnaStavkaErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
			this.uxIDDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIDBlagajnaIzvjestajDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxDatumDokumentaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxUlazDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIzlazDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxDateUICreatedDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxOpisDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIDKontoDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			this.uxPrimateljDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIDOrganizacijaDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxTipStavkeDataGridViewColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
			this.uxIDKlijentDataGridViewColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
			//this.uxIDBlagajnaIzvjestajBindingSource = new BlagajnaIzvjestajBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDBlagajnaIzvjestajBindingSource)).BeginInit();
			//this.uxIDKlijentBindingSource = new KlijentBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDKlijentBindingSource)).BeginInit();
			//this.uxIDKontoBindingSource = new KontoBindingSource(this.components);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDKontoBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxBlagajnaStavkaDataGridView)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxBlagajnaStavkaBindingSource)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.uxBlagajnaStavkaErrorProvider)).BeginInit();
			this.SuspendLayout();
						
			// 
			// uxBlagajnaStavkaErrorProvider
			// 
			this.uxBlagajnaStavkaErrorProvider.ContainerControl = this;
			this.uxBlagajnaStavkaErrorProvider.DataSource = this.uxBlagajnaStavkaBindingSource;						
			// 
			// uxBlagajnaStavkaDataGridView
			// 
			this.uxBlagajnaStavkaDataGridView.AutoGenerateColumns = false;
			this.uxBlagajnaStavkaDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
			this.uxBlagajnaStavkaDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
		this.uxIDDataGridViewColumn,
		this.uxIDBlagajnaIzvjestajDataGridViewColumn,
		this.uxDatumDokumentaDataGridViewColumn,
		this.uxUlazDataGridViewColumn,
		this.uxIzlazDataGridViewColumn,
		this.uxDateUICreatedDataGridViewColumn,
		this.uxOpisDataGridViewColumn,
		this.uxIDKontoDataGridViewColumn,
		this.uxPrimateljDataGridViewColumn,
		this.uxIDOrganizacijaDataGridViewColumn,
		this.uxTipStavkeDataGridViewColumn,
		this.uxIDKlijentDataGridViewColumn			});
			this.uxBlagajnaStavkaDataGridView.Dock = System.Windows.Forms.DockStyle.Fill;
			this.uxBlagajnaStavkaDataGridView.Location = new System.Drawing.Point(0, 0);
			this.uxBlagajnaStavkaDataGridView.Name = "uxBlagajnaStavkaDataGridView";
			this.uxBlagajnaStavkaDataGridView.Size = new System.Drawing.Size(470, 300);
			this.uxBlagajnaStavkaDataGridView.TabIndex = 0;	
			this.uxBlagajnaStavkaDataGridView.BackgroundColor = System.Drawing.Color.WhiteSmoke;
			this.uxBlagajnaStavkaDataGridView.EnableHeadersVisualStyles = false;
			this.uxBlagajnaStavkaDataGridView.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.OnBlagajnaStavkaDataGridViewDataError);
			this.uxBlagajnaStavkaDataGridView.CellValueNeeded += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnBlagajnaStavkaDataGridViewCellValueNeeded);
			this.uxBlagajnaStavkaDataGridView.CellValuePushed += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnBlagajnaStavkaDataGridViewCellValuePushed);
			
			//
			// uxIDDataGridViewColumn
			//
			this.uxIDDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDDataGridViewColumn.DataPropertyName = "ID";
			this.uxIDDataGridViewColumn.HeaderText = "ID";
			this.uxIDDataGridViewColumn.Name = "uxIDDataGridViewColumn";
			this.uxIDDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDDataGridViewColumn.ReadOnly = true;		
			//
			// uxIDBlagajnaIzvjestajDataGridViewColumn
			//
			this.uxIDBlagajnaIzvjestajDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDBlagajnaIzvjestajDataGridViewColumn.DataPropertyName = "IDBlagajnaIzvjestaj";
			this.uxIDBlagajnaIzvjestajDataGridViewColumn.HeaderText = "IDBlagajnaIzvjestaj";
			this.uxIDBlagajnaIzvjestajDataGridViewColumn.Name = "uxIDBlagajnaIzvjestajDataGridViewColumn";
			this.uxIDBlagajnaIzvjestajDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDBlagajnaIzvjestajDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDBlagajnaIzvjestajDataGridViewColumn.ReadOnly = false;		
			//
			// uxDatumDokumentaDataGridViewColumn
			//
			this.uxDatumDokumentaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxDatumDokumentaDataGridViewColumn.DataPropertyName = "DatumDokumenta";
			this.uxDatumDokumentaDataGridViewColumn.HeaderText = "DatumDokumenta";
			this.uxDatumDokumentaDataGridViewColumn.Name = "uxDatumDokumentaDataGridViewColumn";
			this.uxDatumDokumentaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxDatumDokumentaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxDatumDokumentaDataGridViewColumn.ReadOnly = false;		
			//
			// uxUlazDataGridViewColumn
			//
			this.uxUlazDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxUlazDataGridViewColumn.DataPropertyName = "Ulaz";
			this.uxUlazDataGridViewColumn.HeaderText = "Ulaz";
			this.uxUlazDataGridViewColumn.Name = "uxUlazDataGridViewColumn";
			this.uxUlazDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxUlazDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxUlazDataGridViewColumn.ReadOnly = false;		
			//
			// uxIzlazDataGridViewColumn
			//
			this.uxIzlazDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIzlazDataGridViewColumn.DataPropertyName = "Izlaz";
			this.uxIzlazDataGridViewColumn.HeaderText = "Izlaz";
			this.uxIzlazDataGridViewColumn.Name = "uxIzlazDataGridViewColumn";
			this.uxIzlazDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIzlazDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIzlazDataGridViewColumn.ReadOnly = false;		
			//
			// uxDateUICreatedDataGridViewColumn
			//
			this.uxDateUICreatedDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxDateUICreatedDataGridViewColumn.DataPropertyName = "DateUICreated";
			this.uxDateUICreatedDataGridViewColumn.HeaderText = "DateUICreated";
			this.uxDateUICreatedDataGridViewColumn.Name = "uxDateUICreatedDataGridViewColumn";
			this.uxDateUICreatedDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxDateUICreatedDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxDateUICreatedDataGridViewColumn.ReadOnly = false;		
			//
			// uxOpisDataGridViewColumn
			//
			this.uxOpisDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxOpisDataGridViewColumn.DataPropertyName = "Opis";
			this.uxOpisDataGridViewColumn.HeaderText = "Opis";
			this.uxOpisDataGridViewColumn.Name = "uxOpisDataGridViewColumn";
			this.uxOpisDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxOpisDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxOpisDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDKontoDataGridViewColumn
			//
			this.uxIDKontoDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDKontoDataGridViewColumn.DataPropertyName = "IDKonto";
			this.uxIDKontoDataGridViewColumn.HeaderText = "IDKonto";
			this.uxIDKontoDataGridViewColumn.Name = "uxIDKontoDataGridViewColumn";
			this.uxIDKontoDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDKontoDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDKontoDataGridViewColumn.ReadOnly = false;		
			//
			// uxPrimateljDataGridViewColumn
			//
			this.uxPrimateljDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxPrimateljDataGridViewColumn.DataPropertyName = "Primatelj";
			this.uxPrimateljDataGridViewColumn.HeaderText = "Primatelj";
			this.uxPrimateljDataGridViewColumn.Name = "uxPrimateljDataGridViewColumn";
			this.uxPrimateljDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxPrimateljDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxPrimateljDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDOrganizacijaDataGridViewColumn
			//
			this.uxIDOrganizacijaDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDOrganizacijaDataGridViewColumn.DataPropertyName = "IDOrganizacija";
			this.uxIDOrganizacijaDataGridViewColumn.HeaderText = "IDOrganizacija";
			this.uxIDOrganizacijaDataGridViewColumn.Name = "uxIDOrganizacijaDataGridViewColumn";
			this.uxIDOrganizacijaDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDOrganizacijaDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDOrganizacijaDataGridViewColumn.ReadOnly = false;		
			//
			// uxTipStavkeDataGridViewColumn
			//
			this.uxTipStavkeDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxTipStavkeDataGridViewColumn.DataPropertyName = "TipStavke";
			this.uxTipStavkeDataGridViewColumn.HeaderText = "TipStavke";
			this.uxTipStavkeDataGridViewColumn.Name = "uxTipStavkeDataGridViewColumn";
			this.uxTipStavkeDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxTipStavkeDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxTipStavkeDataGridViewColumn.ReadOnly = true;		
			//
			// uxIDKlijentDataGridViewColumn
			//
			this.uxIDKlijentDataGridViewColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.DisplayedCells;
			this.uxIDKlijentDataGridViewColumn.DataPropertyName = "IDKlijent";
			this.uxIDKlijentDataGridViewColumn.HeaderText = "IDKlijent";
			this.uxIDKlijentDataGridViewColumn.Name = "uxIDKlijentDataGridViewColumn";
			this.uxIDKlijentDataGridViewColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True;
			this.uxIDKlijentDataGridViewColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
			this.uxIDKlijentDataGridViewColumn.ReadOnly = false;		
			//
			// uxIDBlagajnaIzvjestajDataGridViewColumn
			//				
			this.uxIDBlagajnaIzvjestajDataGridViewColumn.DisplayMember = "DatumOd";	
			this.uxIDBlagajnaIzvjestajDataGridViewColumn.ValueMember = "ID";	
			this.uxIDBlagajnaIzvjestajDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDBlagajnaIzvjestajDataGridViewColumn.DataSource = uxIDBlagajnaIzvjestajBindingSource;				
				
			//
			// uxIDKlijentDataGridViewColumn
			//				
			this.uxIDKlijentDataGridViewColumn.DisplayMember = "ImeKlijenta";	
			this.uxIDKlijentDataGridViewColumn.ValueMember = "ID";	
			this.uxIDKlijentDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDKlijentDataGridViewColumn.DataSource = uxIDKlijentBindingSource;				
				
			//
			// uxIDKontoDataGridViewColumn
			//				
			this.uxIDKontoDataGridViewColumn.DisplayMember = "Sifra";	
			this.uxIDKontoDataGridViewColumn.ValueMember = "ID";	
			this.uxIDKontoDataGridViewColumn.DisplayStyleForCurrentCellOnly = true;
			//uxIDKontoDataGridViewColumn.DataSource = uxIDKontoBindingSource;				
				
			
			// this
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.Controls.Add(this.uxBlagajnaStavkaDataGridView);
			this.Name = "BlagajnaStavkaDataGridView";
			this.Size = new System.Drawing.Size(470, 300);
			//((System.ComponentModel.ISupportInitialize)(this.uxIDBlagajnaIzvjestajBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDKlijentBindingSource)).EndInit();
			//((System.ComponentModel.ISupportInitialize)(this.uxIDKontoBindingSource)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxBlagajnaStavkaErrorProvider)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxBlagajnaStavkaDataGridView)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.uxBlagajnaStavkaBindingSource)).EndInit();
			this.ResumeLayout(false);
		}
		#endregion
				
		#region events
		
		/// <summary>
		/// Raised the CurrentEntityChanged event.
		/// </summary>
		protected void OnCurrentEntityChanged()
		{
			if (CurrentEntityChanged != null)
			{
				BlagajnaStavkaDataGridViewEventArgs args = new BlagajnaStavkaDataGridViewEventArgs();
				args.BlagajnaStavka = _currentBlagajnaStavka;
				CurrentEntityChanged(this, args); 
			}
		}
		
		#endregion
		
		/// <summary>
		/// Strongly typed event 
		/// </summary>
		public class BlagajnaStavkaDataGridViewEventArgs : System.EventArgs
		{
			private Entities.BlagajnaStavka	_BlagajnaStavka;
	
			/// <summary>
			/// the  Entities.BlagajnaStavka instance.
			/// </summary>
			public Entities.BlagajnaStavka BlagajnaStavka
			{
				get { return _BlagajnaStavka; }
				set { _BlagajnaStavka = value; }
			}	
		}
		
		/// <summary>
		/// Handles the DataError event of the uxBlagajnaStavkaDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewDataErrorEventArgs"/> instance containing the event data.</param>
		protected void OnBlagajnaStavkaDataGridViewDataError(object sender, System.Windows.Forms.DataGridViewDataErrorEventArgs e)
		{
			System.Diagnostics.Debug.WriteLine(string.Format( "{0}, {1}", e.ColumnIndex, e.RowIndex));
		}
		
		/// <summary>
		/// Handles the CellValueNeeded event of the uxBlagajnaStavkaDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnBlagajnaStavkaDataGridViewCellValueNeeded(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxBlagajnaStavkaDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						e.Value = BlagajnaStavkaList[e.RowIndex].ID;
						break;
					case "uxIDBlagajnaIzvjestajDataGridViewColumn":
						e.Value = BlagajnaStavkaList[e.RowIndex].IDBlagajnaIzvjestaj;
						break;
					case "uxDatumDokumentaDataGridViewColumn":
						e.Value = BlagajnaStavkaList[e.RowIndex].DatumDokumenta;
						break;
					case "uxUlazDataGridViewColumn":
						e.Value = BlagajnaStavkaList[e.RowIndex].Ulaz;
						break;
					case "uxIzlazDataGridViewColumn":
						e.Value = BlagajnaStavkaList[e.RowIndex].Izlaz;
						break;
					case "uxDateUICreatedDataGridViewColumn":
						e.Value = BlagajnaStavkaList[e.RowIndex].DateUICreated;
						break;
					case "uxOpisDataGridViewColumn":
						e.Value = BlagajnaStavkaList[e.RowIndex].Opis;
						break;
					case "uxIDKontoDataGridViewColumn":
						e.Value = BlagajnaStavkaList[e.RowIndex].IDKonto;
						break;
					case "uxPrimateljDataGridViewColumn":
						e.Value = BlagajnaStavkaList[e.RowIndex].Primatelj;
						break;
					case "uxIDOrganizacijaDataGridViewColumn":
						e.Value = BlagajnaStavkaList[e.RowIndex].IDOrganizacija;
						break;
					case "uxTipStavkeDataGridViewColumn":
						e.Value = BlagajnaStavkaList[e.RowIndex].TipStavke;
						break;
					case "uxIDKlijentDataGridViewColumn":
						e.Value = BlagajnaStavkaList[e.RowIndex].IDKlijent;
						break;
				default:
				break;
			}
		}
		
		/// <summary>
		/// Handles the CellValuePushed event of the uxBlagajnaStavkaDataGridView control.
		/// </summary>
		/// <param name="sender">The source of the event.</param>
		/// <param name="e">The <see cref="T:System.Windows.Forms.DataGridViewCellValueEventArgs"/> instance containing the event data.</param>
		protected void OnBlagajnaStavkaDataGridViewCellValuePushed(object sender, System.Windows.Forms.DataGridViewCellValueEventArgs e)
		{
			switch(uxBlagajnaStavkaDataGridView.Columns[e.ColumnIndex].Name)
			{
					case "uxIDDataGridViewColumn":
						BlagajnaStavkaList[e.RowIndex].ID = (System.Int32)e.Value;
						break;
					case "uxIDBlagajnaIzvjestajDataGridViewColumn":
						BlagajnaStavkaList[e.RowIndex].IDBlagajnaIzvjestaj = (System.Int32)e.Value;
						break;
					case "uxDatumDokumentaDataGridViewColumn":
						BlagajnaStavkaList[e.RowIndex].DatumDokumenta = (System.DateTime)e.Value;
						break;
					case "uxUlazDataGridViewColumn":
						BlagajnaStavkaList[e.RowIndex].Ulaz = (System.Decimal)e.Value;
						break;
					case "uxIzlazDataGridViewColumn":
						BlagajnaStavkaList[e.RowIndex].Izlaz = (System.Decimal)e.Value;
						break;
					case "uxDateUICreatedDataGridViewColumn":
						BlagajnaStavkaList[e.RowIndex].DateUICreated = (System.DateTime)e.Value;
						break;
					case "uxOpisDataGridViewColumn":
						BlagajnaStavkaList[e.RowIndex].Opis = (System.String)e.Value;
						break;
					case "uxIDKontoDataGridViewColumn":
						BlagajnaStavkaList[e.RowIndex].IDKonto = (System.Int32)e.Value;
						break;
					case "uxPrimateljDataGridViewColumn":
						BlagajnaStavkaList[e.RowIndex].Primatelj = (System.String)e.Value;
						break;
					case "uxIDOrganizacijaDataGridViewColumn":
						BlagajnaStavkaList[e.RowIndex].IDOrganizacija = (System.Int32)e.Value;
						break;
					case "uxTipStavkeDataGridViewColumn":
						BlagajnaStavkaList[e.RowIndex].TipStavke = (System.Int32)e.Value;
						break;
					case "uxIDKlijentDataGridViewColumn":
						BlagajnaStavkaList[e.RowIndex].IDKlijent = (System.Int32?)e.Value;
						break;
				default:
				break;
			}
		}
	}
}
